"use strict";
/*
 * @Author: Jiraiya
 * @Date: 2020-03-12 12:01:49
 * @LastEditors: Jiraiya
 * @LastEditTime: 2020-03-12 16:13:27
 * @Description:
 */
// 执行 tsc检查编译
//🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
// 泛型
function id(x) {
    return x;
}
const val = id('123');
function sum(arr) {
    const sum = arr.reduce((total, val) => total + val, 0);
    return Promise.resolve(sum);
}
sum([1, 2, 3]).then(res => { console.log(res); });
//🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
//泛型实现链表
class CommentList {
    constructor(value, next) {
        this.value = value;
        this.next = next;
    }
    setNext(next) {
        this.next = next;
        return next;
    }
    grow(value) {
        const t = new CommentList(value);
        this.setNext(t);
        return t;
    }
    toString() {
        return this.next ?
            JSON.stringify(this.value) + ' -> ' + this.next.toString() :
            JSON.stringify(this.value) + ' -> null';
    }
}
const c = new CommentList(1);
c.grow(2).grow(3).grow(4);
console.log(c.toString());
const n = [[1, '1'], [1, '1']];
const sayName = (name, suffix) => {
    return name + ' ' + suffix;
};
sayName('王', '先生');
//🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
//never是any的对立面 跟谁都不相等 除了自己
let ne;
const obj = {
    permission: 100,
    name: 'ww',
};
function sayObjName(obj) {
    console.log(obj.name);
}
sayObjName({ name: 'ww' });
const map1 = {
    a: { name: 'ww', age: 2 }
};
const personKey = 'sex';
const m = {
    name: 1,
    address: 2
};
const pp = {
    name: '1',
    address: '2',
    sayName() { }
};
const obj1 = {
    a: 1,
    b() { return 'x'; },
    c() { return 1; },
    d: 'x'
};
const obj3 = {
    a: 'x',
    c: true
};
